Secure microcontrollers can contain Read Only Memory (ROM) for software program storage and Electrically Erasable Programmable Read-Only Memory (EEPROM) for data storage. The EEPROM technology increases dramatically in cost when reduced to sub-micron size, causing some secure micro-controllers to move to a different non-volatile memory technology, such as flash, which is less costly to shrink. Flash technology, in particular, can additionally allow for greater design flexibility because no ROM mask processing is needed.
Using an EEPROM, data can be erased and/or written by byte if necessary. In flash memories, as little as a single byte of data can be written, but the memory can only be erased by page or by block (e.g., according to the particular flash memory architecture). The software within the secure microcontroller would have to perform a read-modify-write operation on the page (or the block) to emulate a single byte data update.
After a number of erases, a non-volatile memory cell will wear out. The memory endurance of a flash memory cell (e.g., 100,000 erases, 10,000 erases, etc.), for example, depends upon manufacturing factors. Various hardware and/or software techniques may be utilized to extend the lifetime of non-volatile memory. For example, wear leveling techniques can be applied to average the writes across the memory cells. Memory cell usage, for example, can be rotated to ensure that individual memory cells are not exposed to greater than average erasures. Wear leveling techniques can incur slower response times, however, because of software management requirements. The slower response times can, in some situations, cause slower software functionality (e.g., in the situation in which program and data are both stored within a non-volatile memory).